#include "widget.h"
#include <project.h>
#include <QApplication>
#include <QLocale>
#include <QTranslator>
#include <QCoreApplication>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // 初始化航空客运订票系统，加载航班信息
    FlightBookingSystem bookingSystem("/Users/hefeiyu/Downloads/big_project/flights.JSON",
                                      "/Users/hefeiyu/Downloads/big_project/passengers.JSON",
                                      "/Users/hefeiyu/Downloads/big_project/candidatepassengers.JSON");

    QTranslator translator;
    const QStringList uiLanguages = QLocale::system().uiLanguages();
    for (const QString &locale : uiLanguages) {
        const QString baseName = "ui_" + QLocale(locale).name();
        if (translator.load(":/i18n/" + baseName)) {
            a.installTranslator(&translator);
            break;
        }
    }
    Widget w(bookingSystem);
    w.show();
    return a.exec();
}
